<?php
// 获取待处理任务
// header("content-type:text/html;charset=utf-8");
include_once("conn.php");

if(empty($_GET['searchway'])){
    $sql = "SELECT * FROM tb_fixinfo_request
        INNER JOIN tb_fix_repairer ON tb_fix_repairer.fix_id = tb_fixinfo_request.fix_id
        AND tb_fixinfo_request.fix_status = '1'
        ORDER BY tb_fix_repairer.r_date DESC";
}else{
    $pass;
}

$result = mysqli_query($conn_DB,$sql);
if ($result){
    if(mysqli_num_rows($result) <= 0){
        echo "<tr><td colspan='6'>暂无待处理任务</td></tr>";
    }else{
        while($row = mysqli_fetch_object($result)){
            $sql_1 = "SELECT * FROM tb_repairer WHERE r_id = '".$row->r_id."'";
            $result_1 = mysqli_query($conn_DB,$sql_1);
            $row_1 = mysqli_fetch_object($result_1);
            echo"
                <tr>
                    <td>".$row->fix_name."</td>
                    <td>".$row->fix_sendtime."</td>
                    <td>".$row->fix_phone."</td>
                    <td>".$row_1->r_name."</td>
                    <td>".$row_1->r_phone."</td>
                    <td>".$row->r_date."</td>
                </tr>
            ";
        }
    }
}